﻿using System.Collections.Generic;
using System.ServiceModel.Activation;
using Acaweb.Common;
using Acaweb.Model.Entities;
using Components = Acaweb.Componentes.Contracts;
using System.Linq;

namespace Acaweb.Servicios.Services
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class FormulariosService : Contracts.IFormulariosService
    {
        Components.ITiposFormulariosService _FormulariosComponent = AppCtx.Resolve<Components.ITiposFormulariosService>();
        Components.IValoresFormulariosService _ValoresComponent = AppCtx.Resolve<Components.IValoresFormulariosService>();

        public TiposFormularios GetById(int Id)
        {
            TiposFormularios T = _FormulariosComponent.GetById(Id);

            return T;
        }

        public void SaveForm(Suscritos Formulario, List<ValoresFormularios> Valores)
        {
            Formulario.Respuestas = Valores;

            _FormulariosComponent.SaveForm(Formulario);
        }

        public List<Suscritos> GetByFormulario(int IdFormulario)
        {
            return _ValoresComponent.GetByFormulario(IdFormulario).ToList();
        }
    }
}